/*  
 *  BoardStatus.cs
 *  Copyright(c) 2007 Adam W Adair
 *
 *  This file is part of Adam's Chess Engine (ACE).
 *
 *  ACE is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *   
 *  ACE is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with ACE; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
using System;
using System.Collections.Generic;
using System.Text;

namespace ACE.Board
{
    /// <summary>
    /// Used to track board history.  Contains the move that was played, and the 
    /// the status of the board before the move was played.  The whole idea is to 
    /// be able to undo a move after the board has been changed.  
    /// </summary>
    class BoardStatus
    {
        /// <summary>
        /// The side to move.  0=WHITE, 1=BLACK
        /// </summary>
        public readonly int SideToMove;               // side to move
        /// <summary>
        /// enpassant square
        /// </summary>
        public readonly int EnpassantSqr;
        /// <summary>
        /// number of moves since last capture
        /// </summary>
        public readonly int NoCaptureMoves;
        /// <summary>
        /// Number of half movesThis is relative to the  starting posistion.  
        /// It is possible for a fen position to start mid game at ply 0.
        /// </summary>
        public readonly int Ply;
        /// <summary>
        /// Hash of the current board position.
        /// </summary>
        public readonly bool WhiteCanCastleKingSide;
        /// <summary>
        /// true if black can castle kingside.
        /// </summary>
        public readonly bool BlackCanCastleKingSide;
        /// <summary>
        /// true if white can castle queen side.
        /// </summary>
        public readonly bool WhiteCanCastleQueenside;
        /// <summary>
        /// true if black can castle queen side.
        /// </summary>
        public readonly bool BlackCanCastleQueenside;
        /// <summary>
        /// The game ply.
        /// </summary>
        public readonly int GamePly;
        /// <summary>
        /// Move number for the game.
        /// </summary>
        public readonly int GameMove;
        /// <summary>
        /// The move that was made.
        /// </summary>
        public Move MoveMade;

        public BoardStatus(ChessBoard board, Move move)
        {
            SideToMove = board.SideToMove;
            EnpassantSqr = board.EnpassantSqr;
            NoCaptureMoves = board.NoCaptureMoves;
            Ply = board.Ply;
            GamePly = board.Ply;
            GameMove = board.GameMove;
            WhiteCanCastleKingSide = board.WhiteCanCastleKingSide;
            BlackCanCastleKingSide = board.BlackCanCastleKingSide;
            WhiteCanCastleQueenside = board.WhiteCanCastleQueenside;
            BlackCanCastleQueenside = board.BlackCanCastleQueenside;
            MoveMade = move;
        }

    }

}
